#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int INF=0x3f3f3f3f;
int main()
{
	int n;
	cin>>n;
	ll M=1e10;
	ll m=0;
	while(n--)
	{
		ll a,b;
		cin>>a>>b;
		M=min(a/b,M);
		m=max(a/(b+1)+1,m);
	}
	cout<<m<<' '<<M;

	return 0;
}

